package com.fcat.springboot.redis.service;


import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;

public interface RedisService {


    String getStringValue(String key);

    void setStringValue(String key, String value);

    //list操作
    void leftPushForList(String key, Object value);

    void rightPushForList(String key, Object value);

    Object indexForList(String key, int index);

    List<Object> rangeForList(String key, int start, int end);

    Long sizeForList(String key);

    void setForList(String key, Integer index, Object value);

    void removeForList(String key, Object value, int count);

    void trimForList(String key, Integer start, Integer end);

    Object leftPopForList(String key);

    Object rightPopForList(String key);

    boolean setValue(String key, Object value);

    boolean setValue(String key, Object value, Long time);

    boolean setValue(String key, Object value, Long time, TimeUnit util);

    Object getValue(String key);

    void deleteKey(String key);

    Set getKeys(String s);

    List getValuesByKeys(Set<String> keys);

    void mapPutAll(String hashName, Map<String, Object> map);

    void mapPut(String hashName, String hashKey, Object hashValue);

    <V> void mapPutList(Class<V> v, String hashName, Map<String, List<V>> map);
    <V> void mapPutMap(Class<V> v, String hashName, Map<String, V> map);

    <K, V> void mapPutMap(Class<K> k, Class<V> v, String hashName, Map<String, Map<K, V>> map);

    Object mapGet(String hashName, String hashKey);

    void mapDelete(String hashName, String... hashKey);

    List<Object> mapGetAllValue(String hashName);

    List<Object> mapGetAllKey(String hashName);

    Long mapSize(String hashName);

    void mapClear(String hashName);

    Map<String, Object> mapGetAll(String hashName);

    boolean setIsMember(String setName, String value);

    Long setAdd(String setName, String value);

    void setAdd(String setName, Object... value);

    void setAdd(String setName, String... value);

    Long setRemove(String setName, String value);

    <T> Set<T> setGetAll(Class<T> t, String setName);

    /**
     * 使用redis 管道 进行批量查询
     *
     * @param keys
     * @return
     */
    Map<String, Object> batchQueryByKeys(List<String> keys);

    <T> Map<String, T> batchQueryMapByKeys(Class<T> t, String mapName, List<String> keys);

    Set<String> getLeftLikeKeys(String key);

    <T> Map<String, T> mapGetAll(Class<T> t, String hashName);

    <K, V> Map<String, Map<K, V>> mapGetAll(Class<K> s, Class<V> v, String hashName);

    <HK, HV> Map<HK, HV> mapGetAll2(Class<HK> hk, Class<HV> hv, String hashName);

    <T> Map<String, List<T>> mapGetList(Class<T> t, String hashName);
}